#ifndef BOARD_H
#define BOARD_H

#include <QWidget>
#include"stone.h"
class board : public QWidget
{
    Q_OBJECT
public:
    explicit board(QWidget *parent = nullptr);
    void paintEvent(QPaintEvent *);
    stone _s[32];//定义32颗棋子
    int _r;//棋子的半径
    int _selectid;
    bool _bRedTurn;
    bool _bSide;

    //返回象棋棋盘行列对应的像素坐标
    QPoint center(int _row,int _col);//返回棋盘上棋子的像素坐标
    QPoint center(int id);
    bool getRowCol(QPoint pt,int&row,int&col);
    int getStoneId(int row, int col);
    bool isDead(int id);

    void drawstone(QPainter&painter, int id);//在棋盘上绘出棋子
    //void paintEvent(QPaintEvent *);
    void mouseReleaseEvent(QMouseEvent *);


    bool canMove(int moveid,int row,int col,int killid);

    bool canMoveJIANG(int moveid,int row,int col,int killid);
    bool canMoveSHI(int moveid,int row,int col,int killid);
    bool canMoveXIANG(int moveid,int row,int col,int killid);
    bool canMoveCHE(int moveid,int row,int col,int killid);
    bool canMoveMA(int moveid,int row,int col,int killid);
    bool canMovePAO(int moveid,int row,int col,int killid);
    bool canMoveBING(int moveid,int row,int col,int killid);

    int getStoneCountAtLine(int row1, int col1, int row2, int col2);
    int relation(int row1, int col1, int row, int col);
    bool isBottomSide(int id);

signals:

public slots:
};

#endif // BOARD_H
